# 定义一个StreamHandler，将INFO级别或更高的日志信息打印到标准错误，并将其添加到当前的日志处理对象#
# -*- coding: utf-8 -*-
import logging
import logging.handlers
import os
import path
import _thread
import time
import pandas as pd
## console = logging.StreamHandler()
# console.setLevel(logging.INFO)
# formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
# console.setFormatter(formatter)
# logging.getLogger('Celue').addHandler(console)
#
# LOG_FILE = 'Celue.log'
#
# handler = logging.handlers.RotatingFileHandler(LOG_FILE, maxBytes=1024 * 1024, backupCount=5,encoding = "UTF-8")  # 实例化handler
# fmt = '%(asctime)s | %(filename)-12s:%(lineno)-5s | %(levelname)-8s | %(message)s'
# datefmt = '%Y-%m-%d %H:%M:%S'
#
# formatter = logging.Formatter(fmt, datefmt)  # 实例化formatter
# handler.setFormatter(formatter)  # 为handler添加formatter
#
# logger = logging.getLogger('Celue')  # 获取名为tst的logger
# logger.addHandler(handler)  # 为logger添加handler
# logger.setLevel(logging.DEBUG)
#
# logger = logging.getLogger('Celue')
# logger.info(u'我擦擦')


''' 测试的 tick脏数据
from datetime import datetime



def ceshi(dt):
    if(dt.hour==11 and dt.minute>29) or (dt.hour==13 and dt.minute<30):
        print('扔掉')
    else:
        print("通过")
if __name__=="__main__":
    dt = datetime(2017, 6, 6, 13, 25)
    ceshi(dt)
'''



 #多线程测试  如果有耗时操作  但是又害怕当前的流程被阻塞  就直接扔给多线程去操作了
#
# def b():
#     a=0
#
#     print("开始运行b")
#     time.sleep(0.5)
#     print("b运行完毕了%s" %(a+1))
# def a():
#     print("开始运行a")
#     time.sleep(0.1)
#     _thread.start_new(b,())
#
# if __name__ == "__main__":
#
#     for i in range(3):
#         a()
#     input()
import requests

def urlfangewn():
    postdata = {'straid': '20170906082712'}
    try:
        r = requests.post("http://localhost:5000/loadstra", data=postdata, timeout=60)
    except requests.exceptions.ReadTimeout:
        print('超时异常')
        return

    print(r.text)

if __name__=='__main__':
    #urlfangewn()
    dfweek = pd.read_csv('D:/python Project/at_py/py_at/report/WeekEquity.csv', header=None, index_col=0, \
                         names=['captical'])
    print(dfweek['captical'])
    initfund = dfweek['captical'][0]
    print(initfund)